var app = getApp(),
  $ = require("../../utils/httpHelper.js")
Page({
  data: {
    // tab切换  
    currentTab: 1,
    re_pay:false,
    objarr: [],
    page: 1,
    pagesize: 5,
    totalpage: 0,//最大页数
    height: 0,
    user_status:'n',
    cats:[],
    nomore: true,
    jfen:0
  },
  onShareAppMessage: function (res) {
    let member_id = app.globalData.userInfo.member_id
    return {
      title: '依依脱毛',
      path: '/pages/index/index?inviter_id=' + member_id,
      success: function (res) {
        // 转发成功
      },
      fail: function (res) {
        // 转发失败
      }
    }
  },
  onLoad: function () {
    var self = this;
    wx.getSystemInfo({
      success: function (res) {
        console.log(res);
        self.setData({ height: res.windowHeight })
      }
    })
    
  },
  onShow(){
    this.getData();
  },
  getData(){
    this.setData({
      page: 1,
    })
    let par = {
      rd_session: app.globalData.userInfo.rd_session,
      page:this.data.page,
      page_size:this.data.pagesize
    }
    $.httpPost("good_list_jifen", par, (data, err) => {
      this.setData({
        objarr:data.data.lists,
        totalpage:data.data.total_page,
        jfen: data.data.member_info.point
      })
    })
  },
  //滑动到底部 上拉加载
  scrollBottom: function () {
    this.data.page++
    if (this.data.page > this.data.totalpage) {
      this.setData({
        nomore: false
      })
    } else {
      let params = {
        rd_session: app.globalData.userInfo.rd_session,
        page: this.data.page,
        page_size: this.data.pagesize
      }
      $.httpPost("good_list_jifen", params, (data, err) => {
        let arr = this.data.objarr;
        for (let item of data.data.lists) {
          arr.push(item);
        }
        this.setData({
          objarr: arr
        })
      })


    }

  },
  togz(){
    wx.navigateTo({
      url: '/pages/integral/gz',
    })
  },
  todetail(e) {
    let id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/goods/goods_detail_buy?id=' + id + '&status=' + 'jifen',
    })
  },
  
    
})  